﻿using System;
using System.Buffers;
using System.Collections.Specialized;
using System.Net;
using System.Text;

namespace SuperSocket.Client.HttpCode;

public sealed class HttpRequest
{
    public string ContentType { get; private set; }

    public string Method { get; private set; }

    public string Path { get; private set; }

    public string HttpVersion { get; private set; }

    public NameValueCollection Items { get; private set; }

    public ReadOnlySequence<byte> Body { get; set; }

    public HttpStatusCode StatusCode { get; set; }

    public HttpRequest(string method, string path, string httpVersion, NameValueCollection items)
    {
        Method = method;
        Path = path;
        HttpVersion = httpVersion;
        Items = items;
        ContentType = items.Get("Content-Type");
        if (int.TryParse(path, out int code))
            StatusCode = (HttpStatusCode)code;
    }
}